<?php

namespace MyContent\Model\Entity;

class StickyNote {
	
	protected $_id;
	protected $_created;
	protected $_note;
	
	public function __construct(array $options = null)
	{
		if(is_array($options))
		{
			$this->setOptions($options);
		}
	}
	
	public function __set($name, $value)
	{
		$method = 'set'. $name;
		if(!method_exists($this, $method))
		{
			throw new \Exception('Invalid method');
		}
		return $this->$method($value);
	}
	
	public function __get($name)
	{
		$method = 'get'. $name;
		if(!method_exists($this, $method))
		{
			throw new \Exception('Invalid method');
		}
		return $this->$method();
	}
	
	public function setOptions(array $options)
	{	
		$methods = get_class_methods($this);
		foreach ($options as $key => $value)
		{
			$method = 'set'. ucfirst($key);
			if(in_array($method, $methods)){
				$this->$method($value);
			}
		}
		return $this;
	}
	
	public function getId() {
		return $this->_id;
	}
	
	public function setId($id) {
		$this->_id = $id;
		return $this;
	}
	
	public function getNote() {
		return $this->_note;
	}
	
	public function setNote($note) {
		$this->_note = $note;
		return $this;
	}
	
	public function getCreated() {
		return $this->_created;
	}
	
	public function setCreated($created) {
		$this->_created = $created;
		return $this;
	}
	
	
	
	
}